package com.partsoft.dits;

/**
 * 边界异常类
 */
public class EdgeException extends RuntimeException {

	private static final long serialVersionUID = 5185964304658644049L;
	
	private EdgeDescriptor descriptor;
	
	public EdgeException(EdgeDescriptor descriptor, String message) {
		super(message);
		this.descriptor = descriptor;
	}
	
	public EdgeException(EdgeDescriptor descriptor, String message, Throwable e) {
		super(message, e);
		this.descriptor = descriptor;
	}
	
	public EdgeException(EdgeDescriptor descriptor, Throwable e) {
		super(e);
		this.descriptor = descriptor;
	}
	
	public EdgeException(EdgeDescriptor descriptor) {
		super();
		this.descriptor = descriptor;
	}
	
	public EdgeDescriptor getDescriptor() {
		return descriptor;
	}
	
	@Override
	public String toString() {
		StringBuffer buffer = new StringBuffer();
		if (getDescriptor() != null) {
			buffer.append("处理\"").append(getDescriptor().toString()).append("\"时发生错误:");
		}
		buffer.append(getMessage()).append("。");
		return buffer.toString();
	}
	
}
